package com.ndp.fb.scheduler;

import com.alibaba.dubbo.container.Main;
import com.ndp.ec.core.api.GoogleGaService;
import com.ndp.fb.config.BaseConfig;
import com.ndp.fb.config.XmlBaseConfig;
import com.ndp.fb.dubbo.container.ContainerPost;
import com.ndp.fb.dubbo.container.SpringBootContainer;
import com.ndp.fb.mq.api.service.schedulerservice.HttprequestSchedulerService;
import com.ndp.fb.scheduler.job.business.StatsFetchJob;
import com.ndp.fb.scheduler.job.productfeed.ProductFeedJob;
import com.ndp.fb.scheduler.job.statistics.FetchGaDataJob;
import org.springframework.context.ApplicationContext;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by infi on 2015/1/23.
 */
public class Scheduler {
    public static void main(String[] args) {

        BaseConfig.DEV = true;
        Properties prop = System.getProperties();
        prop.setProperty("https.proxyHost", "proxy.dy");
        prop.setProperty("https.proxyPort", "3128");
        XmlBaseConfig.LoadXmlConfig = false;
        SpringBootContainer.containerPostList.add(new ContainerPost() {
            @Override
            public void doPost(ApplicationContext applicationContext) {


                try {
//                ProductFeedJob productFbFeedJob = applicationContext.getBean(ProductFeedJob.class);
//                productFbFeedJob.fetchFeed();

//                    FetchGaDataJob bean = applicationContext.getBean(FetchGaDataJob.class);
//                    bean.fetchGaDataByDate();

                    GoogleGaService googleGaService = applicationContext.getBean(GoogleGaService.class);

                    googleGaService.fetchGaDataByDay(888L,46823110484018L,114492766L,null,"2016-06-12","2016-07-12");
//                googleGaService.fetchGaDataByDay();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }

        });

        String[] argsparams = {"springboot"};
        Main.main(argsparams);
    }
}

